package com.qf.listener;

import com.event.EventListener;
import com.qf.entity.Msg;
import com.qf.util.ChannelUtil;
import io.netty.channel.Channel;
import org.springframework.stereotype.Component;

@Component
public class TixingMsgListener implements EventListener<Msg> {
    @Override
    public String eventType() {
        return "tixing";
    }

    @Override
    public void eventHandler(Msg msg) {
        //获取消息的发送对象
        String toDev = msg.getToDev();
        Channel channel = ChannelUtil.getChannel(toDev);
        //给该对象发送消息
        channel.writeAndFlush(msg);
    }
}
